//
//  NSObject+YTMapBlock.m
//  YiTuDriverClient
//
//  Created by 石少庸 on 2017/8/7.
//  Copyright © 2017年 Yitu. All rights reserved.
//

#import "NSObject+YTMapBlock.h"

@implementation NSObject (YTMapBlock)

+ (ValidatePhone)yt_validatePhoneWithAreaCode:(NSString *)areaCode {
    return ^id (NSString *phoneNum) {
        if ([areaCode isEqualToString:@"86"]) {
            return @([NSString yt_checkTelNumberValidate:phoneNum]);
        }
        return @(phoneNum.length >= 5);
    };
}

+ (ValidatePassword)yt_validateStrWithLenght:(NSInteger)length {
    return ^id (NSString *str) {
        return @(str.length >= length);
    };
}

+ (ButtonEnabled)yt_btnNormalColor:(UIColor *)normalColor disabled:(UIColor *)disabledColor {
    return ^UIColor * (NSNumber *number) {
        return number.boolValue ? normalColor : disabledColor;
    };
}

@end
